﻿using KFC.ServiceReferenceKFC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace KFC.MonAnF
{
    public class SafeMonAn: MonAn
    {
        public void Attach(MonAn monAn)
        {
            this.MaMonAn = monAn.MaMonAn;
            this.TenMonAn = monAn.TenMonAn;
            this.DonGia = monAn.DonGia;
            this.ChiTietMonAn = monAn.ChiTietMonAn;
            this.SoLuong = monAn.SoLuong;
            this.LoaiDoiTuong = monAn.LoaiDoiTuong;
            this.ExtraAttributes = monAn.GetExtraAttributes();
        }

        private XmlDocument _extraAttributes;

        public XmlDocument ExtraAttributes
        {
            get { return _extraAttributes; }
            set { _extraAttributes = value; }
        }

        public SafeMonAnDTO convertToDTO()
        {
            SafeMonAnDTO safeMonAnDTO = new SafeMonAnDTO();

            safeMonAnDTO.MaMonAn = this.MaMonAn;
            safeMonAnDTO.TenMonAn = this.TenMonAn;
            safeMonAnDTO.DonGia = this.DonGia;
            safeMonAnDTO.ChiTietMonAn = this.ChiTietMonAn;
            safeMonAnDTO.SoLuong = this.SoLuong;
            safeMonAnDTO.LoaiDoiTuong = this.LoaiDoiTuong;
            safeMonAnDTO.ExtraAttributes = new XmlDocument();
            safeMonAnDTO.ExtraAttributes = this.ExtraAttributes;

            return safeMonAnDTO;
        }
    }
}
